Skip to content

feat: add tests for admin transfer consistency and oracle delete_result TTL#721

Merged
yahia008 merged 2 commits into
StellarCheckMate:mainfrom
Markodiba6399:feat/add-test-admin-transfer-consistency-and-oracle-delete-result-ttl
Jun 1, 2026
Merged

feat: add tests for admin transfer consistency and oracle delete_result TTL#721
yahia008 merged 2 commits into
StellarCheckMate:mainfrom
Markodiba6399:feat/add-test-admin-transfer-consistency-and-oracle-delete-result-ttl

Conversation

@Markodiba6399
Copy link
Copy Markdown

@Markodiba6399 Markodiba6399 commented Jun 1, 2026

Summary

  • New test test_transfer_admin_and_two_step_transfer_are_mutually_consistent (escrow): chains the one-step transfer_admin path with the two-step propose_admin + accept_admin path and asserts the final admin state is identical — new admin accepted, previous admin rejected with explicit auth mocks.
  • New test test_instance_ttl_extended_on_delete_result (oracle): advances the ledger past MATCH_TTL_LEDGERS / 2 so the TTL drops below the extension threshold, then calls delete_result and asserts the instance TTL is restored to MATCH_TTL_LEDGERS, confirming consistency with every other oracle method.

Bug fixes (unblocked by restoring compilation)

  • create_match missing extend_ttl for DataKey::GameId — the key was stored in persistent storage without a TTL extension, so it archived after the default minimum TTL. Any test that advanced the ledger (e.g. expire-match tests) would panic with Error(Storage, InternalError) when expire_match tried to remove the archived key. Fixed by adding extend_ttl(MATCH_TTL_LEDGERS, MATCH_TTL_LEDGERS) for the GameId entry in create_match.
  • Reconstructed two corrupted test functions in escrow/src/tests.rs — a previous edit had interleaved test_instance_ttl_refreshed_after_create_match inside test_lowering_timeout_after_match_creation_affects_expiry_immediately, splitting a create_match call and leaving orphaned code. Both tests are restored to standalone, correct implementations.
  • Wrong ledger offset in test_cancel_and_expire_terminal_state_and_ledger_metadata — the second set_sequence_number used 100 + DEFAULT_MATCH_TIMEOUT_LEDGERS instead of 500 + DEFAULT_MATCH_TIMEOUT_LEDGERS, making elapsed < timeout so expire_match would never succeed.

Test plan

  • cargo test -p escrow — 102 passed, 0 failed
  • cargo test -p oracle — 37 passed, 0 failed
  • Both new tests visible by name in test output and marked ok

closes #625
closes #626

Markodiba and others added 2 commits June 1, 2026 09:44
…lt TTL

- Add test_transfer_admin_and_two_step_transfer_are_mutually_consistent:
  verifies that using transfer_admin (one-step) followed by
  propose_admin + accept_admin (two-step) produces consistent final
  admin state — new admin accepted, previous admin rejected.

- Add test_instance_ttl_extended_on_delete_result: confirms
  delete_result calls extend_instance_ttl consistently with every
  other oracle method, restoring instance TTL to MATCH_TTL_LEDGERS.

Fix pre-existing bugs unblocked by restoring compilation:
- create_match omitted extend_ttl for DataKey::GameId, causing
  expire_match to panic with Storage::InternalError in tests that
  advanced the ledger past the minimum TTL.
- Reconstructed two interleaved test functions that had been corrupted
  by a bad insertion, and corrected a wrong ledger offset (100 → 500)
  in the expire path of test_cancel_and_expire_terminal_state_and_ledger_metadata.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Markodiba6399 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@yahia008 yahia008 merged commit 5e9b8dd into StellarCheckMate:main Jun 1, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Test: oracle delete_result extends instance TTL Add Test: transfer_admin and two-step admin transfer remain mutually consistent

3 participants